<template>
  <div>
    <div class="list">
      <ul>
        <router-link
          v-for="(item, index) in siteArr"
          :key="index"
          :to="'/' + item.site"
        >
          <li>{{ item.title }}</li>
        </router-link>
        <li @click="quitHandle">退出</li>
      </ul>
    </div>
  </div>
</template>

<script>
import { mapMutations } from "vuex";
export default {
  data() {
    return {
      siteArr: [
        {
          id: 1001,
          site: "userinvitation",
          title: "我的帖子",
        },
        {
          id: 1002,
          site: "usercommunity",
          title: "我的评论",
        },
        {
          id: 1003,
          site: "userenshrine",
          title: "我的收藏",
        },
        {
          id: 1004,
          site: "userset",
          title: "设置",
        },
      ],
    };
  },
  methods: {
    ...mapMutations("login", ["setUser"]),
    // 退出登录
    quitHandle() {
      this.$bus.$emit("UserFlag", false);
      this.setUser("");
      localStorage.removeItem("blueberryUser");
    },
  },
};
</script>

<style lang="less" scoped>
.list {
  padding-top: 10px;
  background: #fff;
  li {
    color: #000;
    padding: 0 0 10px 10px;
    text-align: left;
    line-height: 20px;
    font-size: 14px;
  }
}
</style>